import Vue from 'vue'
import Vuex from 'vuex'
import { getItem ,setItem} from '@/utils/storage'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    user: getItem('data')
  },
  getters: {
  },
  mutations: {
    user(state,data) {
      state.user = data 
      //把它存储到本地
      // localStorage.setItem('data', JSON.stringify(data))
      setItem('data',data)
    }
  },
  actions: {
  },
  modules: {
  }
})
